<?php
/**
 * Factory.php class file.
 * @author wudg <544038230@qq.com>
 * @date 2021/1/8- 下午2:46
 */

namespace common\jobs;


use Littlesqx\AintQueue\Driver\DriverFactory;
use Yii;
class Factory
{

    /**
     * 工厂模式写入队列
     * @param string $channel
     * @return \Littlesqx\AintQueue\QueueInterface
     * @throws \Littlesqx\AintQueue\Exception\InvalidDriverException
     */
    public static function make(string $channel)
    {

        $config = require Yii::getAlias('@config/aint-queue.php');
        $driverOption = $config[$channel]['driver'] ?? [];

        return DriverFactory::make($channel, $driverOption);
    }
}